package com.zblibrary.networddemo;

import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
import com.zblibrary.cainetwork.okhttp.bean.TextPostMapBean;
import com.zblibrary.cainetwork.okhttp.network.NetWorks;
import java.util.HashMap;
import java.util.Map;

import rx.Observer;

public class MainActivity extends AppCompatActivity {

    public String TAG = "MainActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        Map<String, String> map = new HashMap<>();
        map.put("mobile", "15814903830");
        map.put("pwd", "123456");
        NetWorks.PostTextPostMapBean(map, new Observer<TextPostMapBean>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {
                //错误回调
                Log.e(TAG, e.toString());
            }

            @Override
            public void onNext(TextPostMapBean textPostMapBean) {
                Toast.makeText(MainActivity.this, textPostMapBean.getMsg(), Toast.LENGTH_SHORT).show();
            }
        });
    }
}
